﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameSnake
{
    class GameLogik
    {
       private GameEngine _gameEngien;
       private Field field;
       private Snake MySnake;
       private Food foo;
       private GameRender gr; 
       public GameLogik()
       {
           _gameEngien = new GameEngine();
           _gameEngien.Tick += OnTickFired;
       }
       private void OnTickFired(object sender, EventArgs e)
       {

           Console.CursorVisible = false;
           gr.RenderSnake(this.MySnake);
           gr.RenderField(this.field);
           gr.RenderFood(this.foo);
           gr.MySnakeRender(this.MySnake);

           MySnake.Move(MySnake);
 



       }
       public void StartGame()
       {
            this.field = new Field(left: 30, top: 20);
            this.MySnake = new Snake(field._CentrePoint, this.MySnake.LengthOfSnake);
            this.foo = new Food(3, 3);
            this.gr = new GameRender();

           _gameEngien.Start();

       }
       

    }
}
